
import styles from './index.css';
import 'antd/dist/antd.css';
import {
  Table
} from 'antd';


const dataSource = [
  {
    key: '1',
    name: '胡彦斌',
    age: 32,
    address: '西湖区湖底公园1号5',
    time:'123',
    type:'11'
  },
  {
    key: '2',
    name: '胡彦祖1',
    age: 42,
    address: '西湖区湖底公园1号4',
    time:'123',
    type:'11'
  },
  {
    key: '3',
    name: '胡彦祖2',
    age: 33,
    address: '西湖区湖底公园1号3',
    time:'123',
    type:'11'
  },
  {
    key: '4',
    name: '胡彦祖3',
    age: 53,
    address: '西湖区湖底公园1号2',
    time:'123',
    type:'11'
  },
  {
    key: '5',
    name: '胡彦祖4',
    age: 462,
    address: '西湖区湖底公园1号1',
    time:'123',
    type:'11'
  },
];

const columns = [
  {
    title: '编号',
    dataIndex: 'name',
    key: 'name',
  },
  {
    title: '名称',
    dataIndex: 'age',
    key: 'age',
  },
  {
    title: '状态',
    dataIndex: 'address',
    key: 'address',
  },
  {
    title: '时间',
    dataIndex: 'time',
    key: 'time',
  },
  {
    title: '类型',
    dataIndex: 'type',
    key: 'type',
  }

];


class ChannelPage extends React.PureComponent{
  //创建的生命周期
  constructor(props) {
    super(props);
    this.state = {current: 1};
  } 
  //渲染
   render(){
     return(
      <Table dataSource={dataSource} columns={columns} pagination={{
        pageSize:1,
        total:5,
        showSizeChanger:true,
        current:this.state.current,
        onchange:this.changePage,
      }}/>
     );
   }
   //组件卸载，用于没存回收
   componentWillUnmount(){

   }
   //组件将要被重新渲染
   shouldComponentUpdate(){

   }
   

   getSnapshotBeforeUpdate(){

   }
   //组件要被重新渲染
   componentDidUpdate(){

   }

   componentDidCatch(){

   }

   forceUpdate(){

   }
   //组件要接收到新属性
   componentWillReceiveProps(){

   }

   changePage=(page)=>{
     Console.log("执行了么:"+page);
     this.setState({
        current:page,
     });
     
   }
}
export default ChannelPage;
